double activity_pos;
guint activity_blocks;
+ GtkOrientation orientation;
+
guint tick_id;
GtkProgressTracker tracker;
gint64 pulse1;
gboolean right = FALSE;
gboolean top = FALSE;
gboolean bottom = FALSE;
- GtkOrientation orientation;
-
- orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (pbar));
/* Here we set positional classes, depending on which end of the
* progressbar the progress touches.
if (pbar->activity_mode)
{
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (pbar->orientation == GTK_ORIENTATION_HORIZONTAL)
{
left = pbar->activity_pos <= 0.0;
right = pbar->activity_pos >= 1.0;
inverted = pbar->inverted;
if (gtk_widget_get_direction (GTK_WIDGET (pbar)) == GTK_TEXT_DIR_RTL)
{
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (pbar->orientation == GTK_ORIENTATION_HORIZONTAL)
inverted = !inverted;
}
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (pbar->orientation == GTK_ORIENTATION_HORIZONTAL)
{
left = !inverted || pbar->fraction >= 1.0;
right = inverted || pbar->fraction >= 1.0;
GtkAllocation alloc;
int progress_width, progress_height;
gboolean inverted;
- GtkOrientation orientation;
-
- orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (pbar));
inverted = pbar->inverted;
if (gtk_widget_get_direction (GTK_WIDGET (pbar)) == GTK_TEXT_DIR_RTL)
{
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (pbar->orientation == GTK_ORIENTATION_HORIZONTAL)
inverted = !inverted;
}
if (pbar->activity_mode)
{
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (pbar->orientation == GTK_ORIENTATION_HORIZONTAL)
{
alloc.width = progress_width + (width - progress_width) / pbar->activity_blocks;
alloc.x = pbar->activity_pos * (width - alloc.width);
}
else
{
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ if (pbar->orientation == GTK_ORIENTATION_HORIZONTAL)
{
alloc.width = progress_width + (width - progress_width) * pbar->fraction;
alloc.height = progress_height;
gtk_widget_set_parent (pbar->progress_widget, pbar->trough_widget);
/* horizontal is default */
- gtk_orientable_set_orientation (GTK_ORIENTABLE (gtk_widget_get_layout_manager (GTK_WIDGET (pbar))),
- GTK_ORIENTATION_VERTICAL);
+ pbar->orientation = GTK_ORIENTATION_VERTICAL; /* Just to force an update... */
gtk_progress_bar_set_orientation (pbar, GTK_ORIENTATION_HORIZONTAL);
+ gtk_widget_update_orientation (GTK_WIDGET (pbar), pbar->orientation);
gtk_accessible_update_property (GTK_ACCESSIBLE (pbar),
GTK_ACCESSIBLE_PROPERTY_VALUE_MAX, 1.0,
switch (prop_id)
{
case PROP_ORIENTATION:
- g_value_set_enum (value, gtk_orientable_get_orientation (GTK_ORIENTABLE (gtk_widget_get_layout_manager (GTK_WIDGET (pbar)))));
+ g_value_set_enum (value, pbar->orientation);
break;
case PROP_INVERTED:
g_value_set_boolean (value, pbar->inverted);
inverted = pbar->inverted;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{
- if (gtk_orientable_get_orientation (GTK_ORIENTABLE (widget)) == GTK_ORIENTATION_HORIZONTAL)
+ if (pbar->orientation == GTK_ORIENTATION_HORIZONTAL)
inverted = !inverted;
}
{
GtkBoxLayout *layout;
- layout = GTK_BOX_LAYOUT (gtk_widget_get_layout_manager (GTK_WIDGET (pbar)));
-
- if (gtk_orientable_get_orientation (GTK_ORIENTABLE (layout)) == orientation)
+ if (pbar->orientation == orientation)
return;
- gtk_orientable_set_orientation (GTK_ORIENTABLE (layout), orientation);
+ pbar->orientation = orientation;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
gtk_widget_set_valign (pbar->trough_widget, GTK_ALIGN_FILL);
}
- gtk_widget_update_orientation (GTK_WIDGET (pbar), orientation);
+ gtk_widget_update_orientation (GTK_WIDGET (pbar), pbar->orientation);
update_node_classes (pbar);
+ layout = GTK_BOX_LAYOUT (gtk_widget_get_layout_manager (GTK_WIDGET (pbar)));
+ gtk_orientable_set_orientation (GTK_ORIENTABLE (layout), GTK_ORIENTATION_VERTICAL);
+
g_object_notify (G_OBJECT (pbar), "orientation");
}